program drop _all
program define TABLE7prog, rclass
version 14
syntax, beta0(real) betax(real) betay(real) rhox(real) smallt(integer) ///
        numN(integer) numT(integer)
drop _all
local truLRP = `betax'/(1-`betay')

// Create the data
set obs `numN'
gen id = _n
// "ai" is the part of the error term that doesn't change over time for a given
// unit.
gen ai = rnormal()
expand `numT'
bysort id: gen t=_n
xtset id t
gen error = ai + rnormal()
gen x=rnormal()
replace x = `rhox'*L.x + rnormal() if t > 1
gen y = `beta0'/(1-`betay')
replace y = `beta0' + `betax'*x + `betay'*L.y + error if t > 1

xtdolshm y x if t > `smallt'
return scalar LRP = _b[x]
test _b[x] == `truLRP'
return scalar pLRP = r(p)



end
